package com.guomao.demod;

public class JavaDemo {

    public static void main(String[] args) {

        StringBuilder sb = new StringBuilder();

        //1 匿名内部类
        StringFormatter sf = new StringFormatter() {
            @Override
            public StringBuilder format(String text) {
                return sb.append(text);
            }
        };

        //2 lambda表达式
        StringFormatter sf2 = (String s) -> {
            return sb.append(s);
        };

        //3 简化lambda表达式
        StringFormatter sf3 = s -> sb.append(s);

        //4 方法引用
        StringFormatter sf4 = sb::append;
    }
}
